package com.jin.webvideo.config.filter.access.handler;

import com.jin.webvideo.config.filter.access.AccessControl;
import com.jin.webvideo.config.filter.access.GlobalStore;
import com.jin.webvideo.entity.SessionStore;

import javax.servlet.http.HttpServletRequest;

/**
 * 访问处理器
 */
public interface AccessHandler {
    /**
     * 禁止规则
     */
    interface AccessRule {
        AccessRule NONE = (g, s, r) -> false;
        boolean compute(GlobalStore globalStore, SessionStore store, HttpServletRequest request);
    }
    /**
     *
     * @param store
     * @param request
     * @param access
     * @param handlerChain
     * @return 是否被消费，true被消费， false未被消费
     */
    default boolean handle(GlobalStore globalStore, SessionStore store, HttpServletRequest request, AccessControl.Access access, HandlerChain handlerChain) {
        return true;
    }

    int order();
}
